package exp.day02;


//从键盘输入一段英文，将其中的英文单词分离出来：
// 已知单词之间的分隔符包括空格、 问号、句号(小数点)和分号。
// 例如：输入：There are apples; oranges and peaches on the table.
//输出：there
//are
//apples
//oranges
//and
//peaches
//on
//the
//table
public class P09_Teacher {
    static String s = "There are apples; oranges and peaches on the table.";
    public static void main(String[] args) {
        String t = s.replaceAll("[^a-z]", " "); //将所有的非字母字符转换成空格
        String[] nums = t.split("[^a-z]");  //以非字母分开
//        System.out.println(Arrays.toString(nums));
        for (String i : nums) {
            for (char j : i.toCharArray()) {        //遍历每个单词，若无空格则为单词，即输出
                if (!Character.isWhitespace(j)) {
                    System.out.println(i.trim());
                    break;
                } else break;
            }
        }
    }
}
